package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GwPlatformRightsMapper;
import com.ruoyi.system.domain.GwPlatformRights;
import com.ruoyi.system.service.IGwPlatformRightsService;

import javax.annotation.Resource;

/**
 * 平台权益Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-08
 */
@Service
public class GwPlatformRightsServiceImpl implements IGwPlatformRightsService 
{
    @Resource
    private GwPlatformRightsMapper gwPlatformRightsMapper;

    /**
     * 查询平台权益
     * 
     * @param id 平台权益主键
     * @return 平台权益
     */
    @Override
    public GwPlatformRights selectGwPlatformRightsById(String id)
    {
        return gwPlatformRightsMapper.selectGwPlatformRightsById(id);
    }

    /**
     * 查询平台权益列表
     * 
     * @param gwPlatformRights 平台权益
     * @return 平台权益
     */
    @Override
    public List<GwPlatformRights> selectGwPlatformRightsList(GwPlatformRights gwPlatformRights)
    {
        gwPlatformRights.setDelFlag("0");
        return gwPlatformRightsMapper.selectGwPlatformRightsList(gwPlatformRights);
    }

    /**
     * 新增平台权益
     * 
     * @param gwPlatformRights 平台权益
     * @return 结果
     */
    @Override
    public int insertGwPlatformRights(GwPlatformRights gwPlatformRights)
    {
        gwPlatformRights.setId(IdUtils.fastSimpleUUID());
        gwPlatformRights.setCreateTime(DateUtils.getNowDate());
        gwPlatformRights.setCreateBy(SecurityUtils.getUserId()+"");
        return gwPlatformRightsMapper.insertGwPlatformRights(gwPlatformRights);
    }

    /**
     * 修改平台权益
     * 
     * @param gwPlatformRights 平台权益
     * @return 结果
     */
    @Override
    public int updateGwPlatformRights(GwPlatformRights gwPlatformRights)
    {
        gwPlatformRights.setUpdateTime(DateUtils.getNowDate());
        gwPlatformRights.setUpdateBy(SecurityUtils.getUserId()+"");
        return gwPlatformRightsMapper.updateGwPlatformRights(gwPlatformRights);
    }

    /**
     * 批量删除平台权益
     * 
     * @param ids 需要删除的平台权益主键
     * @return 结果
     */
    @Override
    public int deleteGwPlatformRightsByIds(String[] ids)
    {
        return gwPlatformRightsMapper.deleteGwPlatformRightsByIds(ids);
    }

    /**
     * 删除平台权益信息
     * 
     * @param id 平台权益主键
     * @return 结果
     */
    @Override
    public int deleteGwPlatformRightsById(String id)
    {
        return gwPlatformRightsMapper.deleteGwPlatformRightsById(id);
    }
}
